<?php 
/**
*file commdel.php
* 评论删除
*
*/
define('ACC', true);
require('../include/init.php');
//用户检查
if (empty($_SESSION['username'])) {
	header("location:../index.php");
}

$comment_id = $_GET['comment_id']+0;

$comm = new CommentModel();
//获取art_id
$row = $comm->findRow($comment_id);
$art_id = $row['art_id']+0;

if (!$comm->delete($comment_id)) {
	$info = '删除失败';
	include(ROOT.'view/admin/info.html');
	exit;
}else {
    //删除成功 文章表对应的comm列减一
	$art = new ArtModel();
	if(!$art->commReduce($art_id)){
		return false;
	}else {
	$info = '删除成功';
	include(ROOT.'view/admin/info.html');
	}
}


?>